package com.neu.fenli2023623.controller;

import com.neu.fenli2023623.dto.DoctorDto;
import com.neu.fenli2023623.dto.IntroduceDto;
import com.neu.fenli2023623.entity.Introduce;
import com.neu.fenli2023623.service.IntroduceService;
import com.neu.fenli2023623.util.ResultVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.management.remote.rmi._RMIConnection_Stub;
import java.util.List;

@RestController
@RequestMapping("/Introduce")
public class IntroduceController {
    @Autowired
    private IntroduceService introduceService;

    @RequestMapping("quaryall")
    public ResultVo selectallIntroduce(){
        List<Introduce> introduceList= introduceService.quaryall();
        if (introduceList!=null){
            return ResultVo.ok().data("list",introduceList);
        }else {
            return ResultVo.error();
        }
    }
    @RequestMapping("updateIntroduce")
    public ResultVo update(@RequestBody IntroduceDto record){
        int i = introduceService.updateIntroduce(record);
        if (i>0) {
            return ResultVo.ok("更新成功");
        }else {
            return ResultVo.error("更新失败");
        }
    }//更新医生信息


}
